package com.oo.array_$.case_1;

import java.util.Scanner;

/**
 * HuiWen--输入一个五位正整数，使用数组判断它是不是回文数(例如 12321 是回
 文)
 *
 * @author: Jovi
 * @createTime: 2017-05-11 11:53
 **/
public class HuiWen {

    public static void main(String[] args) {
        int[] a = new int[6];
        Scanner input = new Scanner(System.in);
        System.out.println("Please enter a 5 digit number：");
        int num = input.nextInt();
        int i;
        int temp = num;

        for (i = 0; i < 5; i++) {//resolve
            a[i] = temp %10;
            temp = temp /10;
        }

        boolean isCorrect = true;
        for (i = 0; i < 5; i++) {
            if (!(a[i] == a[4 - i])) {//There are a pair of different is not a palindrome
                isCorrect = false;
                break;
            }
        }

        if (isCorrect) {
            System.out.println(num + "is palindrome");
        } else {
            System.out.println(num + "isn't palindrome");
        }
    }
}
